package com.example.alilist.presenter;

import java.util.List;

import android.content.Context;

import com.example.alilist.model.CellphoneItem;
import com.example.alilist.model.CellphoneModelImp;
import com.example.alilist.model.ICellphoneModel;
import com.example.alilist.model.onLoadCellphonesListener;
import com.example.alilist.view.ICellphoneListView;

public class CellphonePresenter implements onLoadCellphonesListener {

    private ICellphoneListView iCellphoneListView;
    
    private final ICellphoneModel iCellphoneModel;
    
    public CellphonePresenter(ICellphoneListView iCellphoneListView) {
        // TODO Auto-generated constructor stub
        this.iCellphoneListView = iCellphoneListView;
        
        iCellphoneModel = new CellphoneModelImp();
    }
    
    public void readCellphone(Context context) {
        iCellphoneModel.loadCellphones(context, this);
    }

    @Override
    public void loadCellphones(List<CellphoneItem> cells) {
        // TODO Auto-generated method stub
        if (iCellphoneListView != null) {
            iCellphoneListView.onLoadedList(cells);
        }
    }

}
